extends VehicleBody3D

var camera_rotate: bool = false
@onready var camera_pivot = $CameraPivot
@onready var camera = $CameraPivot/Camera


# Called when the node enters the scene tree for the first time.
func _ready():
	camera.look_at(camera_pivot.position)
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	pass

func _input(event):
	if event is InputEventMouseButton:
		if event.is_pressed():
			camera_rotate = true
		if event.is_released():
			camera_rotate = false
	if event is InputEventMouseMotion:
		if camera_rotate: 
			camera_pivot.rotate_y(deg_to_rad(-event.relative.x/2))
			camera_pivot.rotate_x(deg_to_rad(event.relative.y))
			pass

